#include "stonewt.h"
#include <iostream>

Stonewt::Stonewt(double lbs)
{
    pounds = lbs;

    stone = int(lbs) / Lbs_per_stn;
    pds_left = int(lbs) % Lbs_per_stn + lbs - int(lbs);
}
Stonewt::Stonewt(int stn, double lbs)
{
    pounds = lbs + stn * Lbs_per_stn;

    stone = stn;
    pds_left = lbs;
}
Stonewt::Stonewt() {}
Stonewt::~Stonewt()
{

}

void Stonewt::show_lbs() const
{
    using std::cout;
    using std::endl;

    cout << pounds << " pounds" << endl;   
}
void Stonewt::show_stn() const
{
    using std::cout;
    using std::endl;

    cout << stone << " stone, " << pds_left << " pounds" << endl;
}

Stonewt::operator double() const
{
    return pounds;
}
Stonewt::operator int() const
{
    return int(pounds + 0.5);
}

Stonewt Stonewt::operator+(const Stonewt & st) const
{
    Stonewt sum(st.pounds + pounds);
    return sum;
}
Stonewt operator+(double pounds, const Stonewt & st2)
{
    Stonewt sum(pounds + st2.pounds);
    return sum;
}

Stonewt Stonewt::operator*(double multiplier) const
{
    return Stonewt(pounds * multiplier);
}
Stonewt operator*(double multiplier, const Stonewt & st)
{
    return Stonewt(multiplier * st.pounds);
}